home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / xdsn217.zip / ISODEF / ComplexM.def < prev    next >
Text File  |  1994-12-22  |  2KB  |  63 lines

  1. DEFINITION MODULE ComplexMath;
  2.  
  3.   (* Mathematical functions for the type COMPLEX *)
  4.  
  5. CONST
  6.   i =    CMPLX (0.0, 1.0);
  7.   one =  CMPLX (1.0, 0.0);
  8.   zero = CMPLX (0.0, 0.0);
  9.  
  10. PROCEDURE abs (z: COMPLEX): REAL;
  11.   (* Returns the length of z *)
  12.  
  13. PROCEDURE arg (z: COMPLEX): REAL;
  14.   (* Returns the angle that z subtends to the positive real axis *)
  15.  
  16. PROCEDURE conj (z: COMPLEX): COMPLEX;
  17.   (* Returns the complex conjugate of z *)
  18.  
  19. PROCEDURE power (base: COMPLEX; exponent: REAL): COMPLEX;
  20.   (* Returns the value of the number base raised to the power exponent *)
  21.  
  22. PROCEDURE sqrt (z: COMPLEX): COMPLEX;
  23.   (* Returns the principal square root of z *)
  24.  
  25. PROCEDURE exp (z: COMPLEX): COMPLEX;
  26.   (* Returns the complex exponential of z *)
  27.  
  28. PROCEDURE ln (z: COMPLEX): COMPLEX;
  29.   (* Returns the principal value of the natural logarithm of z *)
  30.  
  31. PROCEDURE sin (z: COMPLEX): COMPLEX;
  32.   (* Returns the sine of z *)
  33.  
  34. PROCEDURE cos (z: COMPLEX): COMPLEX;
  35.   (* Returns the cosine of z *)
  36.  
  37. PROCEDURE tan (z: COMPLEX): COMPLEX;
  38.   (* Returns the tangent of z *)
  39.  
  40. PROCEDURE arcsin (z: COMPLEX): COMPLEX;
  41.   (* Returns the arcsine of z *)
  42.  
  43. PROCEDURE arccos (z: COMPLEX): COMPLEX;
  44.   (* Returns the arccosine of z *)
  45.  
  46. PROCEDURE arctan (z: COMPLEX): COMPLEX;
  47.   (* Returns the arctangent of z *)
  48.  
  49. PROCEDURE polarToComplex (abs, arg: REAL): COMPLEX;
  50.   (* Returns the complex number with the specified polar coordinates *)
  51.  
  52. PROCEDURE scalarMult (scalar: REAL; z: COMPLEX): COMPLEX;
  53.   (* Returns the scalar product of scalar with z *)
  54.  
  55. PROCEDURE IsCMathException (): BOOLEAN;
  56.   (* Returns TRUE if the current coroutine is in the exceptional execution state
  57.      because of the raising of an exception in a routine from this module; otherwise
  58.      returns FALSE.
  59.   *)
  60.  
  61. END ComplexMath.
  62.  
  63.